package thread.sleep;

import lombok.SneakyThrows;

public class SleepTest {
    public static void main(String[] args) {
        Thread thread1 = new Thread(() -> {
            try {
                Thread.sleep(2000);
                System.out.println("thread-1 do task");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        thread1.start();

        new Thread(() -> {
            thread1.interrupt();
            System.out.println("thread-2 do task");
        }).start();
    }
}
